﻿ {include file="public/header" /}
<body>
<div class="x-body ">
  <form  class="layui-form">
    <div class="layui-form-item">
      <label for="process_name" class="layui-form-label">类型说明</label>
      <span style="color: red">*</span>
      <div class="layui-input-inline">
        <input type="text" id="process_name" name="process_name" lay-verify="required" autocomplete="off" class="layui-input" >
        <p id="pLog" style="color:red"></p>
      </div>
    </div>
    <div class="layui-form-item">
      <label for="process_price" class="layui-form-label">成本价</label>
      <span style="color: red">*</span>
      <div class="layui-input-inline">
        <input type="text" id="cost_price" name="cost_price"  lay-verify="required"  autocomplete="off" class="layui-input"  placeholder="￥">
      </div>
    </div>
    <div class="layui-form-item">
      <label for="process_price" class="layui-form-label">报价</label>
      <span style="color: red">*</span>
      <div class="layui-input-inline">
        <input type="text" id="process_price" name="process_price"  lay-verify="required"  autocomplete="off" class="layui-input"  placeholder="￥">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label"></label>
      <button class="layui-btn" lay-submit lay-filter="addId">
        增加
      </button>
    </div>
  </form>
</div>
<script>
    layui.use(['form'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;

        //监听提交
        form.on('submit(addId)', function(data){
            //console.log(data);
            $.post("{:url('index/ProcessType/addProcessType')}",data.field,function(info){
                if (info) {
                    layer.alert("添加成功", {icon: 6},function () {
                        window.parent.location.reload();  //刷新父级页面
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前弹出层
                        parent.layer.close(index);
                    });
                }else{
                    layer.alert("添加失败", {icon: 5});
                }
            },'json');
            return false;
        });


    });
</script>
</body>

</html>